import { defineStore } from "pinia"

export const idStore = defineStore('id', {
    state() {
        return {
            goodsId: 349,
        }
    },
    actions: {
        saveGoodsId(id: number) {
            this.goodsId = id
        },
    },
    getters: {
        getGoodsId(): any {
            return this.goodsId
        },
    },
    persist: {
        enabled: true,
        strategies: [
            {
                key: 'goodsId', //设置存储的key
                storage: localStorage, //表示存储在localStorage
            },
        ],
    },
    
})